package com.farah.lease.common.exception;

import com.farah.lease.common.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 不爱跑步的法拉韶
 * @Date 2024-06-24__11:52
 * @Decription 全局异常处理类
 **/
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(LeaseException.class)
    @ResponseBody
    public Result error(LeaseException e){
        e.printStackTrace();
        return Result.fail(e.getCode(),e.getMessage());
    }


}
